@import "../../styles/colors";

@placeholder-text: #999;
@disabled-text: #ccc;

@border-radius: 3px;
@highlight-color: #FFE684;

.cm-select{
  display: inline-block;
  width: 100%;
  box-sizing: border-box;
  vertical-align: middle;
  color: #515a6e;
  font-size: 14px;
  line-height: normal;
  outline: 0;
  position: relative;

  .cm-select-options{
    .cm-input{
      border: 0;
      border-radius: 0;
      padding-left: 16px;
      &:focus{
        box-shadow: none;
      }
    }
  }
  .cm-select-filter-wrap{
    border-bottom: 1px solid #d9d9d9;
    padding-bottom: 5px;
  }

  &.cm-select-hasEmptyOption{
    ul li:first-child {
      border-bottom: 1px solid #ccc;
    }
  }

  &.cm-select-dropup{
    .cm-select-options-wrap {
      top: auto;
      bottom: 30px;
    }
  }
}

.cm-select:hover{
  .cm-select-value{
    border-color: @color-blue;
  }
}

.cm-select-clearable:hover{
  .cm-select-clear{
    display: inline-block;
  }
  .cm-select-cert{
    display: none;
  }
}

.cm-select-value{
  display: block;
  position: relative;
  height: 32px;
  outline: 0;
  padding: 0 16px 0 6px;
  border: 1px solid @color-border;
  border-radius: @border-radius;
  color: @color-ctx;
  background-color: #fff;
  background-image: none;
  transition: all ease-in-out .15s;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;

  &.cm-select-placeholder{
    color: @placeholder-text;
  }
}

.cm-select-disabled{
  .cm-select-value{
    background-color: #f3f3f3;
    opacity: 1;
    cursor: not-allowed;
    color: #ccc;
  }
  .cm-select-cert {
    color: @color-border;
  }
}
.cm-select.cm-select-disabled:hover{
  .cm-select-value{
    border-color: @color-border;
    box-shadow: none;
  }
}

.cm-select-small {
  .cm-select-value{
    height: 24px;
  }
  .cm-select-text{
    height: 22px;
    line-height: 22px;
    font-size: 12px;
  }
  .cm-select-options-wrap{
    top: 24px;
  }
}

.cm-select-large {
  .cm-select-value{
    height: 40px;
  }
  .cm-select-text{
    height: 38px;
    line-height: 38px;
  }
  .cm-select-options-wrap{
    top: 40px;
  }
}

.cm-select-text{
  display: block;
  height: 30px;
  line-height: 30px;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.cm-select-clear,
.cm-select-cert{
  position: absolute;
  top: 50%;
  right: 8px;
  line-height: 1;
  -webkit-transform: translateY(-50%);
  transform: translateY(-50%);
  transform-origin: center center;
  font-size: 12px;
  width: 14px;
  color: #808695;
  transition: all .2s ease-in-out;
}
.cm-select-clear{
  font-size: 14px;
  display: none;
}

.cm-select-options-wrap{
  position: absolute;
  top: 32px;
  min-Width: 100%;
  z-index: 1000;
  margin: 5px 0;
  padding: 5px 0;
  border-radius: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
  background: @color-white;
  transform-origin: top center;
  display: none;
}

.cm-select.cm-select-open{
  .cm-select-options-wrap{
    display: block;
    animation: fadeInUp 0.2s;
    animation-fill-mode: both;
  }
  .cm-select-cert{
    -webkit-transform: translateY(-50%) rotate(180deg);
    transform: translateY(-50%) rotate(180deg);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    -webkit-transform: scaleY(0);
    transform: scaleY(0);
  }

  to {
    opacity: 1;
    -webkit-transform: scaleY(1);
    transform: scaleY(1);
  }
}

.cm-select-options {
  background: @color-white;
  min-width: 100%;
  user-select: none;
  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
}

.cm-select-option {
  list-style: none;
  padding: 0 16px;
  height: 30px;
  line-height: 30px;
  white-space: nowrap;
  clear: both;
  cursor: pointer;
  -webkit-transition: background .3s ease;
  transition: background .3s ease;
  color: @color-ctx;
  position: relative;
  &:hover{
    background-color: #f3f3f3;
    font-weight: 400;
  }
  &.cm-select-group-wrap{
    padding-left:0;
  }
}
.cm-select-option-active{
  background-color: #f3f3f3;
  color: @color-blue-light;
}
.cm-select-multi .cm-select-option-active{
  &:after{
    display: inline-block;
    line-height: 1;
    text-align: center;
    content: '';
    color: rgba(45,140,240,.9);
    position: absolute;
    top: 50%;
    right: 12px;
    width: 5px;
    height: 10px;
    border-right: 1px solid rgba(45,140,240,.9);
    border-bottom: 1px solid rgba(45,140,240,.9);
    transform: rotate(35deg) translate(0, -50%);
    transform-origin: center center;
  }
}

.cm-select-option-disabled {
  cursor: not-allowed;
  color: @color-disabled;
}

.cm-form-group-invalid {
  .cm-select .cm-select-value{
    border-color: #E05B5B;
  }
}

.cm-select-char{
  padding: 5px 10px;
  font-weight: bold;
}

.cm-select-prefix {
  display: inline-block;
  width: 24px;
  vertical-align: middle;
  position: absolute;
  left: 4px;
  top: 0;
  height: 100%;
  line-height: 32px;
  text-align: center;
}
.cm-select-with-prefix {
  .cm-select-text{
    padding-left: 24px;
  }
}

.cm-select-group-title {
  padding-left: 8px;
  font-size: 14px;
  color: #999;
  height: 30px;
  line-height: 30px;
}
.cm-select-group-hidden,
.cm-select-option-hidden{
  display: none;
}

.cm-select-no-data{
  pointer-events: none;
  text-align: center;
}